/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package SolvedProblems;

//462
//import com.sun.xml.internal.ws.util.StringUtils;
import java.io.File;
import java.io.FileInputStream;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

/*
 * @author InspireServe
 */
class Main_462 {
    
    //public static void main(String args[]) throws FileNotFoundException{
    public static String[] cards = {"2", "3", "4", "5", "6", "7", "8", "9", "T", "J", "Q", "K", "A"};
    public static String[] suits = {"S", "H", "D", "C"};
    public static int indexOfJoker = 9;
    public static int indexOfQueen = 10;
    public static int indexOfKing = 11;
    public static int indexOfAce = 12;
    
    public static String[] output = {"PASS", "BID ", "NO-TRUMP"};
    
    public static void main(String args[]) throws IOException{
        //test();
        run();
    }//end of main
    
    //public static void run()throws FileNotFoundException{
    public static void run() throws IOException{
        //take input
        //Scanner lineReader = new Scanner(System.in);
        //BufferedReader lineReader = new BufferedReader(new InputStreamReader(new FileInputStream(new File("input.txt"))));
        BufferedReader lineReader = new BufferedReader(new InputStreamReader(System.in));
        //Scanner lineReader = new Scanner(new File("input.txt"));
        //Scanner valueReader;
        StringTokenizer valueReader;
        String line;
        while (true) {
            line = lineReader.readLine();
            if(line == null){
                break;
            }
            //valueReader = new StringTokenizer(line);
            int totalPoint = 0;
            
            //take upto four rules
            totalPoint += firstRule(line);
            totalPoint += secondRule(line);
            totalPoint += thirdRule(line);
            totalPoint += fourthRule(line);
            
            if(totalPoint >= 16){
                if(allStopped(line)){
                    printf(output[1] + output[2]);
                    continue;
                }
            }//end if
            
            totalPoint += fifthRule(line);
            totalPoint += sixthRule(line);
            totalPoint += seventhRule(line);
            
            if(totalPoint < 14){
                printf(output[0]);
            }else{
                printf(output[1] + suits[getMax(line)]);
            }

        }//end while
        
        /*
         int numberOfTestCases = Integer.parseInt(lineReader.readLine());
         for(int i = 0; i < numberOfTestCases; i++){
        
         }//end for
         */
    }//end of run
    
    public static void test(){
           String str = "KS TH 8H 4H KC 2D 2D 3D KD QD JD 8D 7D";
           String str2 = "AC 3C 4C AS 7S 4S AD TD 7D 5H AH 7H 5H";
           printf("" + suits[getMax(str2)]);
           
    }//end of test
    
    public static void printf(String str){
        System.out.println(str);
    }//end of printf
    
    public static int countMatches(String string, String substring){
        int occurances = 0;
        
        int index = 0;
        while(true){
            index = string.indexOf(substring, index);
            if(index == -1){
                break;
            }
            occurances++;            
            index++;
        }//end while
        
        return occurances;
    }//end of countMatches
    
    public static int firstRule(String str){
           int point = 0;
           for(int i = 0; i < 4; i++){
               point += countMatches(str, cards[9+i]) * (i + 1);
           }//end for
           return point;
    }//end of first rule
    
    public static int secondRule(String str){
        int point = 0;
        
        for(int suitType = 0; suitType < 4; suitType++){
            String suitKing = cards[indexOfKing] + suits[suitType];
            if(str.contains(suitKing)){ //contains king
                //check if no other type of that suit exists
                if(countMatches(str, suits[suitType]) == 1){    //no other card except king exists here
                    point -= 1;
                }//end if
            }//end if
        }//end for
        
        return point;
    }//end of second rule
    
    public static int thirdRule(String str){
        int point = 0;        
        for (int suitType = 0; suitType < 4; suitType++) {
            String suitQueen = cards[indexOfQueen] + suits[suitType];
            if (str.contains(suitQueen)) { //contains king
                //check if no other type of that suit exists
                if (countMatches(str, suits[suitType]) <= 2) {    //no other card except king exists here
                    point -= 1;
                }//end if
            }//end if
        }//end for        
        return point;
    }//end of third rule
    
    public static int fourthRule(String str) {
        int point = 0;
        for (int suitType = 0; suitType < 4; suitType++) {
            String suitJoker = cards[indexOfJoker] + suits[suitType];
            if (str.contains(suitJoker)) { //contains king
                //check if no other type of that suit exists
                if (countMatches(str, suits[suitType]) <= 3) {    //no other card except king exists here
                    point -= 1;
                }//end if
            }//end if
        }//end for        
        return point;
    }//end of third rule
    
    //Add a point for each suit in which the hand contains exactly two cards.
    public static int fifthRule(String str){
        int point = 0;
        for(String suit : suits){
            if(countMatches(str, suit) == 2){
                point++;
            }
        }//end for
        return point;
    }//end of method
    
    //Add two points for each suit in which the hand contains exactly one card.
    public static int sixthRule(String str){
        int point = 0;
        for (String suit : suits) {
            if (countMatches(str, suit) == 1) {
                point += 2;
            }
        }//end for
        return point;
    }//end of method
    
    //Add two points for each suit in which the hand contains no cards.
    public static int seventhRule(String str){
        int point = 0;
        for (String suit : suits) {
            if (countMatches(str, suit) == 0) {
                point += 2;
            }
        }//end for
        return point;
    }//end of method
    
    public static boolean allStopped(String str){
        boolean stopped = false;
        int totalStopped = 0;
        //A suit is stopped if 
        //it contains an ace, 
        //or if it contains a king and at least one other card, 
        //or if it contains a queen and at least two other cards.
        
        for(int suitType = 0; suitType < 4; suitType++){
            //if contains an ace and total cards = 1 then not stopped
            String suitAce = cards[indexOfAce] + suits[suitType];
            String suitKing = cards[indexOfKing] + suits[suitType];
            String suitQueen = cards[indexOfQueen] + suits[suitType];
            
            if(str.contains(suitAce)){
                if(countMatches(str, suits[suitType]) >= 1){
                    totalStopped++;
                    continue;
                }else{
                    break;
                }
            }
            
            if (str.contains(suitKing)) {
                if (countMatches(str, suits[suitType]) >= 2) {
                    totalStopped++;
                    continue;
                } else {
                    break;
                }
            }
            
            if (str.contains(suitQueen)) {
                if (countMatches(str, suits[suitType]) >= 3) {
                    totalStopped++;
                    continue;
                } else {
                    break;
                }
            }            
        }//end for
        
        if(totalStopped == 4){
            stopped = true;
        }
        
        return stopped;
    }//end of all stopped
    
    public static int getMax(String str){
        int index = -1;
        int max = -1;
        
        for(int i = 0; i < 4; i++){
            String suitType = suits[i];
            int total = countMatches(str, suitType);
            if(total > max){
                max = total;
                index = i;
            }
        }//end for
        
        return index;
    }//end of method
}//end of class
